package com.toaa.crazymath.controller;

import com.toaa.crazymath.Constant;

public class AdditionOperator extends BaseOperator {

	@Override
	protected int randomNumber() {
		if (mRandom != null) {
			int randomNumber = mRandom.nextInt(Constant.ADDITION_NUMBER.length);
			return Constant.ADDITION_NUMBER[randomNumber];
		}
		return Constant.ADDITION_NUMBER[0];
	}

	@Override
	public OperatorEntity createExpression() {
		mFactor1 = randomNumber();
		mFactor2 = randomNumber();
		final int correctResult = mFactor1 + mFactor2;
		getActualResult(correctResult);
		return new OperatorEntity(mFactor1, mFactor2, mResult);
	}
	
}
